package com.mine.service;

import com.mine.dao.CartMapper;
import com.mine.pojo.Cart;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CartService {

    @Autowired
    CartMapper cartMapper;

    public List<Cart> queryAllCartByMealId(Integer meal_id) {
        return cartMapper.queryAllCartByMealId(meal_id);
    }

    public void addCart(String meal_id, String orderItem_id, String title, int user_id) {
        cartMapper.addCart(meal_id,orderItem_id,title,user_id);
    }

    public Cart queryCartByUserMealOrderItem(int user_id, String meal_id, String orderitem_id) {
        return cartMapper.queryCartByUserMealOrderItem(user_id,meal_id,orderitem_id);
    }

    public List<Cart> adminqueryMealcart(String meal_id) {
        return cartMapper.queryAllCartByMealId(Integer.valueOf(meal_id));
    }
}
